<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>修改密码</title>
<meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
<meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
<link rel="shortcut icon" href="favicon.ico">
<link href="/Public/Admin/css/bootstrap.min.css" rel="stylesheet">
<link href="/Public/Admin/css/font-awesome.min.css" rel="stylesheet">
<link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/Public/Admin/css/animate.css" rel="stylesheet">
<link href="/Public/Admin/js/plugins/layer/skin/default/layer.css" rel="stylesheet">
<link href="/Public/Admin/css/style.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改密码</h5>
                </div>
                <div class="ibox-content">
                    <form method="post" name="formadd" id="formadd" action="<?php echo U('Pwd/save');?>" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">管理员账号：</label>
                            <div class="col-sm-10">
                                <?php echo session('user.account');?>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">原始密码</label>
                            <div class="col-sm-10">
                                <input type="password" name="oldpwd" id="oldpwd">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>

                            <div class="col-sm-10">
                                <input type="password" name="newpwd" id="newpwd">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">确认密码：</label>
                            <div class="col-sm-10">
                                <input type="password" id="repwd"  name="repwd">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">提交</button>
                                <button class="btn btn-primary" type="reset">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/Public/Admin/js/jquery.min.js"></script>
<script src="/Public/Admin/js/bootstrap.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/messages_zh.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js"></script>
<script src="/Public/Admin/js/comment.js"></script>
<script>
    $(function(){
        $('#formadd').validate({ 
            rules:{
                oldpwd:{required:true, minlength:6, maxlength:15},
                newpwd:{required:true, minlength:6, maxlength:15},
                repwd:{required:true, minlength:6, maxlength:15}
            },
            messages:{
                oldpwd:{required:"原始密码不能为空！",minlength:"密码长度不能少于6位",maxlength:"密码长度不能超过15位"},
                newpwd:{required:"新密码不能为空！",minlength:"密码长度不能少于6位", maxlength:"密码长度不能超过15位"},
                repwd:{required:"确认密码不能为空！",minlength:"密码长度不能少于6位", maxlength:"密码长度不能超过15位"}
            },
            //提交成功后执行
            submitHandler:function(form){
                var objNames = $(form).serializeArray();
                var dataName = new Object();
                $.each(objNames,function(key,val){
                    dataName[val.name] = val.value;
                });
                $.ajax({
                    url:$(form).attr('action'),//地址是通过form 的action
                    type:'post',
                    dataType:'json',
                    data:dataName,//传的对象
                    success:function(data){
                        if(data.status < 1){
                            comment.error(data.mess);
                        }else{
                            comment.success(data.mess,"<?php echo U('Pwd/index');?>");
                        }
                    }
                });

            }
        });
    });
</script>
</body>
</html>